﻿using System;
using UnityEngine;

public class WeaponFactory : IWeaponFactory
{
    public IWeapon CreateWeapon(WeaponType weaponType)
    {
        IWeapon weapon = null;
        WeaponBaseAttr baseAttr = FactoryManager.AttrFactory.GetWeaponBaseAttr(weaponType);
        GameObject go = FactoryManager.AssetFactory.LoadWeapon(baseAttr.AssetName);

        switch (weaponType)
        {
            case WeaponType.Gun:
                weapon = new WeaponGun(baseAttr, go);
                break;
            case WeaponType.Rifle:
                weapon = new WeaponRifle(baseAttr, go);
                break;
            case WeaponType.Rocket:
                weapon = new WeaponRocket(baseAttr, go);
                break;
        }

        return weapon;
    }
}